package com.chenshuang.web;

import com.chenshuang.bean.CartGoods;
import com.chenshuang.service.CartService;
import com.chenshuang.service.GoodsService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "AddGoodsServlet", value = "/addgoods")
public class AddGoodsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        Object num1 = session.getAttribute("num");
        String id = request.getParameter("id");
        String nu = request.getParameter("num");
        Integer num = Integer.valueOf(nu);
        num++;
        CartGoods cartgoods1 = (CartGoods) session.getAttribute("cartgoods");
        cartgoods1.setAllgoodsnum(num);
        session.setAttribute("num",num);
        // 转发 到 购物车页面
        request.getRequestDispatcher("cart.jsp").forward(request,response);


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
